package cn.eeepay.framework.dao;

import cn.eeepay.framework.model.JumpWarn;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

public interface JumpWarnDao {

    @Select("select * from jump_warn")
    @ResultType(JumpWarn.class)
    List<JumpWarn> select();

    @Delete("delete from jump_warn where id = #{id}")
    void delete(Integer id);

    @Insert("insert into jump_warn(jump_id,warn_time,scale,create_time,creator,warn_status) " +
            "values(#{jumpId},#{warnTime},#{scale},#{createTime},#{creator},#{warnStatus})")
    void insert(JumpWarn jumpWarn);

    @Update("UPDATE jump_warn SET jump_id = #{jumpId},warn_time = #{warnTime},scale = #{scale},creator = #{creator} where id = #{id}")
    void update(JumpWarn jumpWarn);

    @Update("UPDATE jump_warn SET warn_status = #{warnStatus} where id = #{id}")
    void updateStatus(@Param("warnStatus") Integer warnStatus, @Param("id") Integer id);

    @Update("update jump_warn set last_warn_time = #{lastWarnTime},warn_status = #{warnStatus} where id = #{id}")
    int updateLastWarnTime(@Param("id") Integer id, @Param("warnStatus") Integer warnStatus, @Param("lastWarnTime") Date lastWarnTime);
}
